<body class="" gtools_scp_screen_capture_injected="true">
    <%include navbar.html%>
        <article class="main-content page-page" itemscope itemtype="http://schema.org/Article">
            <div class="post-header">
                <h1 class="post-title" itemprop="name headline"><%=content.title%></h1>
                <div class="post-data">
                    <time datetime="<%= think.datetime(content.create_time*1000, 'MM DD, YYYY')%>" itemprop="datePublished">Published&nbsp;&nbsp;on&nbsp;&nbsp;
                        <%=think.datetime(content.create_time*1000,'MM DD, YYYY')%>
                    </time>&nbsp;&nbsp;in&nbsp;&nbsp;
                    <a href="<%=site.url %>/category/<%= content.category.slug %>/">
                        <%=content.category.slug%>
                    </a>with<a href="#comments">&nbsp;&nbsp;<%=content.comment.length%>&nbsp;&nbsp;comment</a></div>
            </div>
            <div id="post-content" class="post-content" itemprop="articleBody">
                <p class="post-tags">
                    <%content.tag.forEach(function(tag){%>
                        <a href="<%=site.url %>/tag/<%= tag.slug %>/">
                            <%=tag.slug%>
                        </a>
                        <%});%>
                </p>
                <%-content.content%>
                    <p class="post-info">本文由
                        <a href="javascript:">
                            <%=user.username%>
                        </a>创作，采用<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="external nofollow">知识共享署名4.0</a>国际许可协议进行许可
                        <br>本站文章除注明转载/出处外，均为本站原创或翻译，转载前请务必署名
                        <br>最后编辑时间为:
                        <%=think.datetime(content.modify_time*1000,'MM DD, YYYY')%>
                    </p>
            </div>
        </article>
        <%include comment.html%>
            <div id="directory-content" class="directory-content">
                <div id="directory"></div>
            </div>
        <%include footer.html%>
            <script>
            var postDirectoryBuild = function() { var postChildren = function children(childNodes, reg) { var result = [],
                            isReg = typeof reg === 'object',
                            isStr = typeof reg === 'string',
                            node, i, len; for (i = 0, len = childNodes.length; i < len; i++) { node = childNodes[i]; if ((node.nodeType === 1 || node.nodeType === 9) && (!reg || isReg && reg.test(node.tagName.toLowerCase()) || isStr && node.tagName.toLowerCase() === reg)) { result.push(node) } } return result },
                    createPostDirectory = function(article, directory, isDirNum) { var contentArr = [],
                            titleId = [],
                            levelArr, root, level, currentList, list, li, link, i, len;
                        levelArr = (function(article, contentArr, titleId) { var titleElem = postChildren(article.childNodes, /^h\d$/),
                                levelArr = [],
                                lastNum = 1,
                                lastRevNum = 1,
                                count = 0,
                                guid = 1,
                                id = 'directory' + (Math.random() + '').replace(/\D/, ''),
                                lastRevNum, num, elem; while (titleElem.length) { elem = titleElem.shift();
                                contentArr.push(elem.innerHTML);
                                num = +elem.tagName.match(/\d/)[0]; if (num > lastNum) { levelArr.push(1);
                                    lastRevNum += 1 } else if (num === lastRevNum || num > lastRevNum && num <= lastNum) { levelArr.push(0);
                                    lastRevNum = lastRevNum } else if (num < lastRevNum) { levelArr.push(num - lastRevNum);
                                    lastRevNum = num } count += levelArr[levelArr.length - 1];
                                lastNum = num;
                                elem.id = elem.id || (id + guid++);
                                titleId.push(elem.id) } if (count !== 0 && levelArr[0] === 1) levelArr[0] = 0; return levelArr })(article, contentArr, titleId);
                        currentList = root = document.createElement('ul');
                        dirNum = [0]; for (i = 0, len = levelArr.length; i < len; i++) { level = levelArr[i]; if (level === 1) { list = document.createElement('ul'); if (!currentList.lastElementChild) { currentList.appendChild(document.createElement('li')) } currentList.lastElementChild.appendChild(list);
                                currentList = list;
                                dirNum.push(0) } else if (level < 0) { level *= 2; while (level++) { if (level % 2) dirNum.pop();
                                    currentList = currentList.parentNode } } dirNum[dirNum.length - 1]++;
                            li = document.createElement('li');
                            link = document.createElement('a');
                            link.href = '#' + titleId[i];
                            link.innerHTML = !isDirNum ? contentArr[i] : dirNum.join('.') + ' ' + contentArr[i];
                            li.appendChild(link);
                            currentList.appendChild(li) } directory.appendChild(root) };
            createPostDirectory(document.getElementById('post-content'), document.getElementById('directory'), true) };
            postDirectoryBuild();
            </script>
</body>
<% include bottom.html %>